package one;

public class StrBuilder {
    public static void main(String[] args) {
        /*
        StringBuilder y = new StringBuilder(10);
        System.out.println(y.append("Hello"));
        System.out.println(y.append(" wold"));
        System.out.println(y.insert(10,'!'));
        System.out.println(y.delete(4,9)); //包含前面的索引 不包含结尾的索引



        StringBuffer x = new StringBuffer(20);
        x.append("道子686 道子689 道子"); //增
        System.out.println(x);
        x.insert(14,"678");  //插入
        System.out.println(x);
        x.delete(5,11);  //删除
        System.out.println(x);
         */

        StringBuffer x = new StringBuffer(10);
        System.out.println(x.append("01234567"));
        //delete 删除指定区域内字符  包前不包后;
        System.out.println(x.delete(3,7));

        //reverse() 将字符反转;
        System.out.println(x.reverse());

        //insert  早指定索引值后添加字符;
        System.out.println(x.insert(2,"123"));

        //replace
        System.out.println(x.replace(2,5,"456")); //包前不包后将指定区域内字符串改成指定字符串;

        //capacity
        System.out.println(x.capacity());

    }
}